package com.ssh.crm.utils;

import java.math.BigInteger;
import java.security.MessageDigest;

public class MD5Utils {
	
	public static String md5(String plainText) {
		byte[] secretBytes=null;
		try {
			secretBytes=MessageDigest.getInstance("md5").digest(plainText.getBytes());
		} catch (Exception e) {
			throw new RuntimeException("no md5 match");
		}
		String md5Code=new BigInteger(1,secretBytes).toString(16);
		for (int i = 0; i < 32-md5Code.length(); i++) {
			md5Code="0"+md5Code;
		}
		return md5Code;
	}

}
